<?php
/* SVN FILE: $Id: templatePlugin.php 114 2009-07-17 16:54:40Z supersmashbrothers $ */
/**
* ibMarket 2
* IP.Board 3.0
* ibMarket Item template/base class
*
* @author $Author: supersmashbrothers $
* @copyright $Copyright$
* @version $Revision: 114 $
* @lastrevision $Date: 2009-07-17 16:54:40 +0000 (Fri, 17 Jul 2009) $
* @modifiedby $LastChangedBy: supersmashbrothers $
* @lastmodified $LastChangedDate: 2009-07-17 16:54:40 +0000 (Fri, 17 Jul 2009) $
* @filesource $URL: http://ipb-ibmarket.googlecode.com/svn/ibmarket2/trunk/admin/applications_addon/other/ibmarket/sources/templatePlugin.php $
*/

abstract class templatePlugin
{
	/**
	 * The plugin default name
	 *
	 * @access	protected
	 * @var		string
	 */
	protected static $pluginName;
	
	/**
	 * Cache information to be stored
	 *
	 * @access	protected
	 * @var		array
	 */
	protected static $cacheArray = array();
	
	/**
	 * The plugin information that was stored in database
	 *
	 * @access	protected
	 * @var		array
	 */
	protected $plugin;
	
	/**#@+
	 * Registry Object Shortcuts
	 *
	 * @access	protected
	 * @var		object
	 */
	protected $registry;
	protected $DB;
	protected $settings;
	protected $request;
	protected $lang;
	protected $member;
	protected $memberData;
	protected $cache;
	protected $caches;
	/**#@-*/
	
	/**
	 * Constructor to setup the plugin
	 *
	 * @access	public
	 * @param	ipsRegistry	$registry	IPB registry
	 * @param	array		&$plugin	The plugin information
	 */
	public function __construct(ipsRegistry $registry, array &$plugin = array())
	{
		$this->plugin = &$plugin;
		
		/* Make registry objects */
		$this->registry   =  $registry;
		$this->DB         =  $this->registry->DB();
		$this->settings   =& $this->registry->fetchSettings();
		$this->request    =& $this->registry->fetchRequest();
		$this->lang       =  $this->registry->getClass('class_localization');
		$this->member     =  $this->registry->member();
		$this->memberData =& $this->registry->member()->fetchMemberData();
		$this->cache      =  $this->registry->cache();
		$this->caches     =& $this->registry->cache()->fetchCaches();
	}
	
	/**
	 * Menu to use in the ACP
	 *
	 * @access	public
	 * @return	array
	 */
	public abstract function adminMenu();
	
	/**
	 * Running the ACP for the plugin
	 *
	 * @access	public
	 * @return	void
	 */
	public abstract function adminExecute();
	
	/**
	 * Install the plugin in the ACP
	 *
	 * @access	public
	 * @param	array $plugin	The plugin information to be saved
	 * @return	void
	 */
	public abstract function adminInstall(array &$plugin);
	
	/**
	 * Install the plugin in the ACP
	 *
	 * @access	public
	 * @return	void
	 */
	public abstract function adminSettings();
	
	/**
	 * Saving the settings to the plugin
	 *
	 * @access	public
	 * @return	string	HTML to the settings
	 */
	public abstract function adminSaveSettings(&$input);

	/**
	 * Uninstall the plugin in the ACP
	 *
	 * @access	public
	 * @return	void
	 */
	public abstract function adminUninstall();
	
	/**
	 * Running the plugin on the public side of the ACP
	 *
	 * @access	public
	 * @return	void
	 */
	public abstract function publicExecute();
}
?>